<?php
namespace app\common\model;
use \think\Model;

class WapAsk extends Ask{
	public $tips_info = '';
	/**
	* 列表
	*/
	public function getList($user_id="", $page = 1){

		if(!$user_id){
			$this->tips_info = "对不起，您的操作有误！";
			return false;
		}
		$where['user_id']   = $user_id;
		$where['is_delete'] = 0;
		$where['status']    = 1;
		$order = 'order_id,ask_id desc';

		$query['page'] = $page ? $page : 1;

		$list = model('Ask')->where($where)->order($order)->paginate(10, false, ['query' => $query]);

		return $list ? $list : array();
	}

	/**
	* 总个数
	*/
	public function getCount($user_id = ""){
		if(!$user_id){
			$this->tips_info = "对不起，您的操作有误！";
			return false;
		}
		
		$where['user_id']   = $user_id;
		$where['is_delete'] = 0;
		$where['status']    = 1;
		$order = 'order_id,ask_id desc';
		$count = model('Ask')->where($where)->order($order)->count();

		return $count ? $count : 0;
	}
}